package com.gexiaobao.pigeon.ui.auction

import android.os.Build
import android.os.Bundle
import androidx.annotation.RequiresApi
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.BaseActivity
import com.gexiaobao.pigeon.app.util.StatusBarUtil
import com.gexiaobao.pigeon.databinding.ActivityThematicDetailBinding
import com.gexiaobao.pigeon.viewmodel.AuctionViewModel
import me.hgj.jetpackmvvm.ext.util.setOnclickNoRepeat

/**
 * @Author      : hxw
 * @Date        : 2024/11/12 16:38
 * @Describe    : 专题详情
 */
class ActivityThematicDetail : BaseActivity<AuctionViewModel, ActivityThematicDetailBinding>() {

    @RequiresApi(Build.VERSION_CODES.M)
    override fun initView(savedInstanceState: Bundle?) {
        StatusBarUtil.setTranslucentForImageView(this, 0, null)
        mDatabind.includeBar.toolBarLayout.setBackgroundColor(getColor(R.color.color_99CCFF))
        mDatabind.includeBar.tvTitle.text = "专题详情"
        val auctionId = intent.getStringExtra("auctionId").toString()
        showLoading(getString(R.string.loading))
        mViewModel.getAuctionDescApp(auctionId)
    }

    override fun createObserver() {
        super.createObserver()
        mViewModel.auctionDescResult.observe(this) {
            dismissLoading()
            mDatabind.data = it
        }
    }

    override fun onBindViewClick() {
        super.onBindViewClick()
        setOnclickNoRepeat(mDatabind.includeBar.ivBack) {
            when (it) {
                mDatabind.includeBar.ivBack -> finish()
            }
        }
    }
}